From b0b7188948a2da46932790ada9a8f09626dc948c Mon Sep 17 00:00:00 2001 From: "mjw@wray-m-3.hpl.hp.com" Date: Thu, 19 Aug 2004 14:02:48 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.88 (4124b308xrxOcaDBfOP8TGkxArG9Yg) Checking scripts for the things Xen needs for build and install. --- .rootkeys | 12 +++++++ tools/Makefile | 1 + tools/check/Makefile | 16 +++++++++ tools/check/README | 20 +++++++++++ tools/check/check_brctl | 9 +++++ tools/check/check_curl_devel | 11 ++++++ tools/check/check_curl_lib | 10 ++++++ tools/check/check_logging | 31 ++++++++++++++++ tools/check/check_python | 10 ++++++ tools/check/check_ssl_lib | 10 ++++++ tools/check/check_twisted | 46 ++++++++++++++++++++++++ tools/check/check_zlib_devel | 10 ++++++ tools/check/check_zlib_lib | 10 ++++++ tools/check/chk | 70 ++++++++++++++++++++++++++++++++++++ 14 files changed, 266 insertions(+) create mode 100644 tools/check/Makefile create mode 100644 tools/check/README create mode 100755 tools/check/check_brctl create mode 100755 tools/check/check_curl_devel create mode 100755 tools/check/check_curl_lib create mode 100755 tools/check/check_logging create mode 100755 tools/check/check_python create mode 100755 tools/check/check_ssl_lib create mode 100755 tools/check/check_twisted create mode 100755 tools/check/check_zlib_devel create mode 100755 tools/check/check_zlib_lib create mode 100755 tools/check/chk diff --git a/.rootkeys b/.rootkeys index d7ca5387de..2a7b97b63d 100644 --- a/.rootkeys +++ b/.rootkeys @@ -246,6 +246,18 @@ 410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.7-xen-sparse/mm/page_alloc.c 40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs 3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile +4124b307nRyK3dhn1hAsvrY76NuV3g tools/check/Makefile +4124b307vHLUWbfpemVefmaWDcdfag tools/check/README +4124b307jt7T3CHysgl9LijNHSe1tA tools/check/check_brctl +4124b307HDX972-zihuZWXB7R8Vd0w tools/check/check_curl_devel +4124b307P3bZBkTFm6r-3XTbf0phAA tools/check/check_curl_lib +4124b307u-FeKvFP9kZnh0rLV0XjGg tools/check/check_logging +4124b307tRTjLqzRy60QrUoqN2Fhuw tools/check/check_python +4124b307KcYJMtZ7r48AF-wyhyw-SQ tools/check/check_ssl_lib +4124b307XdznSNCv97lrT3RpOdMM1A tools/check/check_twisted +4124b307lnAATmulpXYa0M-dzxLBDA tools/check/check_zlib_devel +4124b308ly20ptMKQoiztPyP_X68Mw tools/check/check_zlib_lib +4124b308O8yPHMKbj4YPR_grPGZmdA tools/check/chk 401d7e160vaxMBAUSLSicuZ7AQjJ3w tools/examples/Makefile 401d7e16UgeqroJQTIhwkrDVkoWgZQ tools/examples/README 405ff55dawQyCHFEnJ067ChPRoXBBA tools/examples/init.d/xend diff --git a/tools/Makefile b/tools/Makefile index e8cdd96672..527edab8ba 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,6 @@ all: + $(MAKE) -C check $(MAKE) -C libxutil $(MAKE) -C libxc $(MAKE) -C misc diff --git a/tools/check/Makefile b/tools/check/Makefile new file mode 100644 index 0000000000..744f0983b5 --- /dev/null +++ b/tools/check/Makefile @@ -0,0 +1,16 @@ + +all: build + +# Check this machine is OK for building on. +build: + ./chk build + +# Check this machine is OK for installing on. +# DO NOT use this check from 'make install' in the parent +# directory, as that target can be used to make an installable +# copy rather than actually installing. +install: + ./chk install + +clean: + ./chk clean \ No newline at end of file diff --git a/tools/check/README b/tools/check/README new file mode 100644 index 0000000000..e6f105b073 --- /dev/null +++ b/tools/check/README @@ -0,0 +1,20 @@ +Checks for the suitability of a machine for Xen build or install. +To check for build suitability use + + ./chk build + +To check for install suitability use + + ./chk install + +The chk script will run checks in this directory and print +the ones that failed. It prints nothing if checks succeed. +The chk script exits with 0 on success and 1 on failure. + +The chk script runs executable files in this directory whose +names begin with 'check_'. Files containing CHECK-BUILD +are run for the build check, and files containing CHECK-INSTALL +are run for the install check. + +Detailed output from the check scripts is in .chkbuild for build +and .chkinstall for install. \ No newline at end of file diff --git a/tools/check/check_brctl b/tools/check/check_brctl new file mode 100755 index 0000000000..26f3ce6856 --- /dev/null +++ b/tools/check/check_brctl @@ -0,0 +1,9 @@ +#!/bin/bash +# CHECK-INSTALL + +function error { + echo 'Check for the bridge control utils (brctl) failed.' + exit 1 +} + +brctl show || error \ No newline at end of file diff --git a/tools/check/check_curl_devel b/tools/check/check_curl_devel new file mode 100755 index 0000000000..342ff42bf6 --- /dev/null +++ b/tools/check/check_curl_devel @@ -0,0 +1,11 @@ +#!/bin/bash +# CHECK-BUILD + +function error { + echo 'Check for libcurl includes failed.' + exit 1 +} + +set -e +[ -e /usr/include/curl ] || error +[ -e /usr/include/curl/curl.h ] || error \ No newline at end of file diff --git a/tools/check/check_curl_lib b/tools/check/check_curl_lib new file mode 100755 index 0000000000..58b74ed9c8 --- /dev/null +++ b/tools/check/check_curl_lib @@ -0,0 +1,10 @@ +#!/bin/bash +# CHECK-BUILD CHECK-INSTALL + +function error { + echo 'Check for CURL library failed.' + exit 1 +} + +set -e +ldconfig -p | grep libcurl.so || error \ No newline at end of file diff --git a/tools/check/check_logging b/tools/check/check_logging new file mode 100755 index 0000000000..693454c89d --- /dev/null +++ b/tools/check/check_logging @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# CHECK-INSTALL +# -*- mode: python; -*- + +import os +import sys + +def hline(): + print >>sys.stderr, "*" * 70 + +def msg(message): + print >>sys.stderr, "*" * 3, message + +def check_logging(): + """Check python logging is installed and raise an error if not. + Logging is standard from Python 2.3 on. + """ + try: + import logging + except ImportError: + hline() + msg("Python logging is not installed.") + msg("Use 'make install-logging' at the xen root to install.") + msg("") + msg("Alternatively download and install from") + msg("http://www.red-dove.com/python_logging.html") + hline() + sys.exit(1) + +if __name__ == '__main__': + check_logging() diff --git a/tools/check/check_python b/tools/check/check_python new file mode 100755 index 0000000000..321b32dbbe --- /dev/null +++ b/tools/check/check_python @@ -0,0 +1,10 @@ +#!/bin/bash +# CHECK-BUILD CHECK-INSTALL + +function error { + echo "Check for Python version 2.2 or higher failed." + exit 1 +} + +python -V +python -V 2>&1 | cut -d ' ' -f 2 | grep -q -E '^2.2|^2.3|^2.4' || error diff --git a/tools/check/check_ssl_lib b/tools/check/check_ssl_lib new file mode 100755 index 0000000000..ecd64d4a54 --- /dev/null +++ b/tools/check/check_ssl_lib @@ -0,0 +1,10 @@ +#!/bin/bash +# CHECK-BUILD CHECK-INSTALL + +function error { + echo "Check for ssl library failed." + exit 1 +} + +set -e +ldconfig -p | grep libssl.so || error \ No newline at end of file diff --git a/tools/check/check_twisted b/tools/check/check_twisted new file mode 100755 index 0000000000..06d70b4692 --- /dev/null +++ b/tools/check/check_twisted @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# CHECK-INSTALL +# -*- mode: python; -*- + +import os +import sys + +def hline(): + print >>sys.stderr, "*" * 70 + +def msg(message): + print >>sys.stderr, "*" * 3, message + +def check_twisted_version(): + """Check twisted is installed with a supported version and print a warning if not. + Raises an error if twisted is not installed. + """ + # Supported twisted release and major version. + RELEASE = 1 + MAJOR = 3 + try: + from twisted.copyright import version + except ImportError: + hline() + msg("The Twisted framework is not installed.") + msg("Use 'make install-twisted' at the xen root to install.") + msg("") + msg("Alternatively download and install version %d.%d or higher" % (RELEASE, MAJOR)) + msg("from http://www.twistedmatrix.com/products") + hline() + sys.exit(1) + + (release, major, minor) = version.split('.') + release = int(release) + major = int(major) + if release > RELEASE: return + if release == RELEASE and major >= MAJOR: return + hline() + msg("Warning: Twisted version not supported: %s" % version) + msg("Use Twisted version %d.%d.0 or higher" % (RELEASE, MAJOR)) + hline() + sys.exit(1) + +if __name__ == '__main__': + check_twisted_version() + diff --git a/tools/check/check_zlib_devel b/tools/check/check_zlib_devel new file mode 100755 index 0000000000..6f6334bcd0 --- /dev/null +++ b/tools/check/check_zlib_devel @@ -0,0 +1,10 @@ +#!/bin/bash +# CHECK-BUILD + +function error { + echo 'Check for zlib includes failed.' + exit 1 +} + +set -e +[ -e /usr/include/zlib.h ] || error \ No newline at end of file diff --git a/tools/check/check_zlib_lib b/tools/check/check_zlib_lib new file mode 100755 index 0000000000..4e19372843 --- /dev/null +++ b/tools/check/check_zlib_lib @@ -0,0 +1,10 @@ +#!/bin/bash +# CHECK-BUILD CHECK-INSTALL + +function error { + echo 'Check for zlib library failed.' + exit 1 +} + +set -e +ldconfig -p | grep libz.so || error \ No newline at end of file diff --git a/tools/check/chk b/tools/check/chk new file mode 100755 index 0000000000..632da544cb --- /dev/null +++ b/tools/check/chk @@ -0,0 +1,70 @@ +#!/bin/bash + +function usage { + echo "Usage:" + echo "\t$0 [build|install|clean]" + echo + echo "Check suitability for Xen build or install." + echo "Exit with 0 if OK, 1 if not." + echo "Prints only failed tests." + echo + echo "Calling with 'clean' removes generated files." + exit 1 +} + +case $1 in + build) + check="CHECK-BUILD" + info=".chkbuild" + ;; + install) + check="CHECK-INSTALL" + info=".chkinstall" + ;; + clean) + rm -f .chkbuild .chkinstall + exit 0 + ;; + *) + usage + ;; +esac + +failed=0 + +echo "Xen ${check} " $(date) > ${info} +for f in check_* ; do + case $f in + *~) + continue + ;; + *) + ;; + esac + if ! [ -x $f ] ; then + continue + fi + if ! grep -q ${check} $f ; then + continue + fi + echo ' ' >> ${info} + echo "Checking $f" >> ${info} + if ./$f 1>>${info} 2>&1 ; then + echo OK >> ${info} + else + failed=1 + echo "FAILED $f" + echo FAILED >> ${info} + fi +done + +echo >> ${info} + +if [ "$failed" == "1" ] ; then + echo "Checks failed. See ${info} for details." + echo "FAILED" >> ${info} + exit 1 +else + echo "OK" >> ${info} + exit 0 +fi \ No newline at end of file -- 2.30.2